<?php
require_once($server->my_site[0]->path.$server->my_site[0]->folder."distributor_manage.php");

$distributor->id or exit("Área reservada a distribuidores");

// First we search for if the order is in the distributor arrays
$myorder=null;
foreach ($distributor->unprocessed_orders as $order) {
	if ($order->id==$_GET['order_id']) {
		$myorder=$order;
		break;
	}
}
if (!$myorder) {
	foreach ($distributor->processed_orders as $order) {
		if ($order->id==$_GET['order_id']) {
			$myorder=$order;
			break;
		}
	}
}

$myorder->db_delete(); // It deletes the order from table orders
$myorder->db_delete_items(); // It deletes the order from table orders_items
?>


<div style="margin: 1em 0;">
	<p>Order removed.</p>
</div>
<script language="javascript">
	reload("#orders","?seccion=orders");
</script>
